﻿<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>

<%@ include file="/core/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
<head>  
	    
    <%@ include file="/core/memberMeta.jsp"%>
   
    <script type="text/javascript" src="<%=basePath%>/resources/js/jquery-1.4.js"></script>
    <link href="<%=basePath%>/resources/js/zTree/zTreeStyle.css" rel="stylesheet"/>
	<script src="<%=basePath%>/resources/js/zTree/jquery.ztree-2.6.min.js" type="text/javascript"></script>
		
	<script type=text/javascript>
			var zTree ;
			var setting;
			var zNodes =[];

			setting = {
			
				async: true,
				
				isSimpleData : true,
				treeNodeKey : "id",
				treeNodeParentKey : "fatherId",
				
				//访问路径
				asyncUrl: "<%=basePath%>/member/member/ajaxTuRecommend.shtml",    				//获取节点数据的URL地址
				asyncParam: ["id"],        	     						//获取节点数据时，必须的数据名称，例如：id、name
				asyncParamOther: ["loginName","${loginName}"],        	//其它参数 ( key, value 键值对格式)
				callback:{
					asyncSuccess: zTreeOnAsyncSuccess,
					expand: zTreeOnExpand
				}
			};
	
			
			
			$(document).ready(function(){
				
				refreshTree();
			});
			
			//异步返回的数据
			function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
				 
				zTree.expandNode(treeNode, false, false,false);
			}

			//刷新数据
			function refreshTree(asyncUrl) {
				
				setting.asyncUrl = "<%=basePath%>/member/member/ajaxTuRecommend.shtml";
				setting.asyncDataFilter = dataFilter;
				
				zTree = $("#tree").zTree(setting, zNodes);
				
			}
			
			//数据过滤
			function dataFilter(treeId, parentNode, childNodes) {
				childNodes=childNodes.menuList;
				
				return childNodes;
			}

			
			
			
			//展开的时候增加孙子
			function zTreeOnExpand(event, treeId, treeNode) {
				
				var nodes = zTree.getNodesByParam("fatherId", treeNode.id, treeNode);
				 
				for(var i =0; i<nodes.length; i++) {
					if(nodes[i].childNum>0){
						nodes[i].isParent=true;
						zTree.updateNode(nodes[i])
						zTree.reAsyncChildNodes(nodes[i], "refresh");
					}else{
						nodes[i].isParent=false;
					}
					
					
				}
			}
	</script> 
</head>
<body>
   
     <div class="container">
            
       	<div class="mws-panel grid_8"  >
           	<div class="mws-panel-header">
               	<span class="mws-i-24 i-group-2" style="font-weight:bold;font-size: 14px;">我的推荐图谱</span>
               </div>
               <div class="mws-panel-body">
                   <div class="mws-wizard clearfix">
                       <ul>
                           <li>
                               <a class="mws-ic-16 ic-house" href="<%=basePath%>/member/info/welcome.shtml" target="frmright" style="font-weight:bold;font-size: 14px;color: black;">首 页</a>
                           </li>
                           <li>
                               <span  class="mws-ic-16 ic-user"  style="font-weight:bold;font-size: 14px;color: black;">我的推荐图谱</span>
                           </li>
                           
                       </ul>
                   </div>
               </div>
               <div class="mws-panel-body">
                  	<div id="tree" name="tree" class="tree" ></div>
		       </div>
           </div>
           
           <div class="mws-panel grid_8 mws-collapsible">
           	   <div class="mws-panel-header">
               		<span class="mws-i-24 i-user-2">会员信息</span>
               </div>
               <div class="mws-panel-body">
                   <iframe id="show" name="show" src="member/member/tuRecommendShow.shtml?loginName=${loginName}" frameborder="0"
									width="100%" height="200" scrolling="no"/>
               </div>
           </div>
       </div>   
    
</body>

</html>


